//=============================================================================
///	Floating-point number
//=============================================================================

#include "sfpnum.h"
#include "sstream.h"
#include "smem.h"


static void fpnum_write(SExp s, SExp strm, int escape) {
	SFPoint* p = &s.ptr->fpnum;
	char buf[32];
	sprintf(buf, "%g", p->val);
	write_cstr(buf, strm);
}

static STypeInfo fpnum_typeinfo = {
	tFPnum,	0,
	"num",
	NULL,
	NULL,
	NULL,
	fpnum_write,
	NULL,
	NULL,
};


//=============================================================================

SExp gen_fpnum(SFPnum x) {
	SFPoint* p = smalloc(sizeof(*p));
	p->typeinfo= &fpnum_typeinfo;
	p->val = x;
	return ptr2s(p);
}
